package com.gykfbxxh.imovie.custom.view.listview;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ListView;

/**
 * 默认全部展开的listview
 * Created by xuxinghai on 2016/10/23.
 */
public class ExpandListview extends ListView {
    public ExpandListview(Context context) {
        super(context);
    }

    public ExpandListview(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ExpandListview(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
//        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        try {
            int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
                    MeasureSpec.AT_MOST);
            super.onMeasure(widthMeasureSpec, expandSpec);
        } catch (Exception e) {
            e.printStackTrace();
            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        }

    }
}
